//
//  Read_Analog_Sensors.c
//  ARDUINO_PROPELLER
//
//  Created by FRANCIS PAPINEAU on 12-02-06.
//  Copyright 2012 carleton university. All rights reserved.
//

void Read_Analog_Sensors(void){
        // 1 - The Light value
        tempLight = analogRead(LightPIN);
        
        // 2 - The ECG Voltage Level
        tempECG = analogRead(ECGPIN);
        
        // 3 - The Battery Voltage Level
        tempBat5V = analogRead(Battery5VPIN);
        
        // 4 - The Battery Voltage Level
        tempBat3P3V = analogRead(Battery3P3VPIN);
        
        // 5 - The Battery Voltage Level
        tempBat9V = analogRead(Battery9VPIN);
        
        // 6 - The Battery Voltage Level
        tempBat18V = analogRead(Battery18VPIN);
        
        // 7 - The Respiration sensor measurments
        tempRESP = analogRead(RespPIN);
}

// --------------------------------------------------------------

bool fill_Buffer(string buffer){
    
    char buf1[5];
    
    buffer += (string)dtostrf(tempLight, 2, 2, buf1);
    buffer += DATA_DELIMETER;
    
    
    buffer += (string)dtostrf(tempECG, 2, 2, buf1);
    buffer += DATA_DELIMETER;

    buffer += (string)dtostrf(tempBat5V, 2, 2, buf1);
    buffer += DATA_DELIMETER;

    buffer += (string)dtostrf(tempBat9V, 2, 2, buf1);
    buffer += DATA_DELIMETER;

    buffer += (string)dtostrf(tempBat3P3V, 2, 2, buf1);
    buffer += DATA_DELIMETER;

    buffer += (string)dtostrf(tempBat18V, 2, 2, buf1);
    buffer += DATA_DELIMETER;

    buffer += (string)dtostrf(tempRESP, 2, 2, buf1);
}